package win.smartown.ada.window;

import android.graphics.PixelFormat;
import android.os.Bundle;
import android.view.Gravity;
import android.view.WindowManager;
import android.view.WindowManager.LayoutParams;
import android.widget.Button;

import win.smartown.aqst.base.BaseActivity;

public class MainActivity extends BaseActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setBaseView(R.layout.activity_main);

        Button button = new Button(this);
        button.setText("button");
        LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 0, 0, PixelFormat.TRANSPARENT);
        layoutParams.flags = LayoutParams.FLAG_NOT_TOUCH_MODAL | LayoutParams.FLAG_NOT_FOCUSABLE | LayoutParams.FLAG_SHOW_WHEN_LOCKED;
        layoutParams.gravity = Gravity.CENTER;
        layoutParams.type = LayoutParams.TYPE_SYSTEM_ERROR;
        getWindowManager().addView(button, layoutParams);
    }

    @Override
    public WindowManager getWindowManager() {
        return super.getWindowManager();
//        return (WindowManager) getSystemService(Context.WINDOW_SERVICE);
    }
}
